// 二、api目录下 单独定义请求函数
// 1.引入request
import request from '@utils/request'

// 2.请求 所有分类接口 方便复用传参
// 文章列表
const fetchArtList = (params = {}) => request.get('/artList', { params })
// parmas 默认为一个空对象，不加花括号 箭头函数直接return一个promise对象
// 增加文章
const fetchAdd = (params = {}) => request.post('/artadd', params)
// 获取文章详情
const fetchArtDetail = (id) => request.get('/artdetail', {
  params: {
    id
  }
})
// 增加文章
const fetchArtEdit = (params = {}) => request.post('/artedit', params)
// 删除文章
const DelArtList = (params = {}) => request.get('/artdel', { params })
// 登录请求
const artLogin = (params = {}) => request.post('/login', params)
// 3.导出方法
export {
  fetchArtList,
  fetchAdd,
  fetchArtDetail,
  fetchArtEdit,
  DelArtList,
  artLogin
}
